home *** CD-ROM | disk | FTP | other *** search
- /*
- File: FWiXExpert.c
-
- Contains: Code to implement FireWire File Exchange driver expert loader.
-
- Version: 1.0
-
- Written by: Jay Lloyd
-
- Copyright: © 1996-1999 by Apple Computer, Inc., all rights reserved.
-
- File Ownership:
-
- DRI: Jay Lloyd
-
- Other Contact:
-
- Technology: FireWire
-
- Writers:
-
- (JRH) Rhoads Hollowell
- (jkl) Jay Lloyd
-
- Change History (most recent first):
-
- <FW6> 4/8/99 jkl Converted to use GDF services.
- <FW5> 2/26/98 JRH Include DriverFamilyMatchingPriv.h
- <FW4> 11/4/97 jkl Deglommed fwix.
- <FW3> 12/27/96 ES Took out some DebugStrs.
- <FW2> 12/20/96 GG Removed FWXExpertTerminate routine and all references to
- FWiXFamily. Added loading of FWiXFamily nlib and FWXScanner Code
- fragment for glom implementation. also added internal routine
- FindExpertFSSpec.
- <FW1> 10/2/96 jkl initial check-in, copied from avt family
-
- */
-
- #include <Types.h>
- #include <Files.h>
- #include <Folders.h>
- #include "GenericDriverFamily.h"
-
- #include "FWiX.h"
- #include "FWiXExpert.h"
-
- GDFDeviceEventRegistrationID gGDFDeviceEventRegistrationID = kInvalidGDFDeviceEventRegistrationID;
- FSSpec gThisFragSpec;
-
- ////////////////////////////////////////////////////////////////////////////////
- //
- // The service descriptor.
- //
-
- GDFServiceDescription TheGDFServiceDescription =
- {
- kGDFServiceDescriptionSignature,
- kInitialGDFServiceDescriptor,
- {
- kServiceCategoryFWiX,
- 1, 0, finalStage, 1,
- 0
- },
- {
- kGDFServiceIsLoadedUponDiscovery,
- "\pFWiX",
- { 0, 0, 0, 0, 0, 0, 0, 0 }
- }
- };
-
-
- ////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- //
- // Private routines.
- //
- ////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
-
- ////////////////////////////////////////////////////////////////////////////////
- //
- // ExpertEntryPoint
- //
- // This routine installs the FireWire File Exchange driver expert loader.
- //
-
- long ExpertEntryPoint(void)
- {
- CInfoPBRec catInfoPB;
- Str63 fileName;
- UInt32 eventTable[1];
- SInt32 extfDirID;
- OSStatus status = noErr;
- SInt16 extfIndex = 1;
- SInt16 extfVRefNum;
-
- // get the extensions folder
- status = FindFolder(kOnSystemDisk, kExtensionFolderType, kDontCreateFolder,
- &extfVRefNum, &extfDirID);
-
- // locate this file and create file spec
- if (status == noErr)
- {
- while (status == noErr)
- {
- fileName[ 0 ] = '\0';
- fileName[ 1 ] = '\0';
- catInfoPB.hFileInfo.ioNamePtr = &fileName[0];
- catInfoPB.hFileInfo.ioVRefNum = extfVRefNum;
- catInfoPB.hFileInfo.ioFDirIndex = extfIndex++;
- catInfoPB.hFileInfo.ioDirID = extfDirID;
-
- status = PBGetCatInfoSync(&catInfoPB);
- if (status == noErr)
- {
- if ((catInfoPB.hFileInfo.ioFlFndrInfo.fdType == 'expt') &&
- (catInfoPB.hFileInfo.ioFlFndrInfo.fdCreator == 'FWiX'))
- {
- status = FSMakeFSSpec(extfVRefNum, extfDirID, catInfoPB.hFileInfo.ioNamePtr, &gThisFragSpec);
- break;
- }
- }
- }
- }
-
- // register file with GDF services
- if (status == noErr)
- status = GDFRegisterFSSpecExpert(&gThisFragSpec);
-
- // Register to receive generic device added events.
- if (status == noErr)
- {
- eventTable[0] = kGDFDeviceAddedEvent;
- eventTable[1] = kGDFDeviceRemovedEvent;
- status = GDFRegisterDeviceEventHandlerProc(
- kServiceCategoryFWiX, 2, &eventTable[0],
- FWXDeviceNotificationHandler, nil,
- &gGDFDeviceEventRegistrationID);
- }
-
- return status;
- }
-
-
- ////////////////////////////////////////////////////////////////////////////////
- //
- // FWXExpertTerminate
- //
- // This proc terminates the FireWire File Exchange driver expert loader.
- //
-
- long FWXExpertTerminate()
- {
- OSStatus status = noErr;
-
- // Unregister with Generic Device family.
- if (gGDFDeviceEventRegistrationID != kInvalidGDFDeviceEventRegistrationID)
- status = GDFUnregisterDeviceEventHandler(gGDFDeviceEventRegistrationID);
-
- return status;
- }
-
-
- ////////////////////////////////////////////////////////////////////////////////
- //
- // GDFExpertEntryPoint
- //
- // Initialize the family.
- //
-
- long GDFExpertEntryPoint(void)
- {
- return ((long) InitializeFWXFamily ());
- }
-